Skip to content

Adds linter warning for using variables defined in parent stages#4935

Closed
daghack wants to merge 1 commit intomoby:masterfrom
daghack:out-of-scope-arg
Closed

Adds linter warning for using variables defined in parent stages#4935
daghack wants to merge 1 commit intomoby:masterfrom
daghack:out-of-scope-arg

Conversation

@daghack
Copy link
Collaborator

@daghack daghack commented May 16, 2024

This adds a linter warning for the case where a build arg is declared, and then later used in a child stage without being redeclared in that stage. For example:

RUN echo "Building version"
ARG username=foo
RUN echo "declared username: $username"

FROM one AS two
# Causes the lint warning
RUN echo "out of scope arg username: $username, define ARG in current stage to use it"

Signed-off-by: Talon Bowler <talon.bowler@docker.com>
@daghack daghack force-pushed the out-of-scope-arg branch from 4dc5167 to 76e4345 Compare May 17, 2024 00:08
@daghack daghack self-assigned this May 17, 2024
@daghack daghack marked this pull request as ready for review May 17, 2024 02:26
@daghack daghack requested review from jsternberg and tonistiigi May 17, 2024 02:26
@daghack daghack marked this pull request as draft May 17, 2024 22:08
@thompson-shaun thompson-shaun modified the milestone: v0.14.0 May 28, 2024
@daghack daghack closed this Jul 2, 2024
@daghack daghack deleted the out-of-scope-arg branch July 2, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants